﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Freebase4net.Bases
{
    public static class Utils
    {
        public static void CopyStream(Stream input, Stream output)
        {
            byte[] buffer = new byte[8 * 1024];
            int len;
            while ((len = input.Read(buffer, 0, buffer.Length)) > 0)
            {
                output.Write(buffer, 0, len);
            }
        }

        public static void CopyStreamToFile(Stream input, string fileName)
        {
            using (Stream file = File.OpenWrite(fileName))
            {
                CopyStream(input, file);
            }
        }
    }
}
